//package com.ruoyi.security.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
//import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
//import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
//import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
//
//@Configuration
//@EnableResourceServer
//public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
//
//    @Autowired
//    private RedisConnectionFactory redisConnectionFactory;
////
//    @Override
//    public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
//        //无状态
//        resources.stateless(true);
//        //设置token存储
//        resources.tokenStore(redisTokenStore());
//    }
//
//    /**
//     * 设置token存储，这一点配置要与授权服务器相一致
//     */
//    @Bean
//    public RedisTokenStore redisTokenStore(){
//        RedisTokenStore redisTokenStore = new RedisTokenStore(redisConnectionFactory);
////        redisTokenStore.setPrefix("auth-token:");
//        return redisTokenStore;
//    }
//}
